home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / tsbat36.zip / ARC2ZIP.BAT < prev    next >
DOS Batch File  |  1992-02-04  |  4KB  |  139 lines

  1. echo off
  2. rem
  3. rem Do not distribute ARC2ZIP.BAT separately from the rest of the package
  4. rem
  5.  
  6. rem If you get an "Out of environment space" message, increase your
  7. rem environment space by using shell configuration in config.sys:
  8. rem Example: shell=c:\bin\command.com /e:1024 /p
  9.  
  10. echo.
  11. echo ┌───────────────────────────────────────────────────────────────┐
  12. echo │ Convert and datestamp a single .arc to .zip file with comment │
  13. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Tue 4-Feb-1992        │
  14. echo └───────────────────────────────────────────────────────────────┘
  15. if not "%1"=="" goto _continue
  16. echo.
  17. echo Usage: ARC2ZIP PackageName [/r(eplace the old .arc with the new .zip)]
  18. echo Use no drive name! No extension!
  19. echo        ┌───────────────┐
  20. echo        │ NO WILDCARDS! │
  21. echo        └───────────────┘
  22. echo.
  23. echo When using for the first time:
  24. echo  1) Copy pkunpak.exe and pkzip.exe to a:\ (not provided)
  25. echo  2) Make a new directory a:\zip for converted files
  26. echo  3) Edit your own zip-file comment to a:\comment.txt (not provided)
  27. echo  4) If you do not have a ramdisk on r:\ alter line a:\pkzip -br:\ «-- ...
  28. echo  5) If you use a harddisk, edit the paths in ARC2ZIP.BAT as appropriate
  29. echo.
  30. echo Usually:
  31. echo  Put the .arc file diskette in drive b:\
  32. echo  Put the ARC2ZIP.BAT diskette in drive a:\
  33. echo  And run normally
  34. goto _out
  35.  
  36. :_continue
  37. rem Do the necessary programs, the comment file, and zip directory exist
  38. if not exist a:\pkzip.exe goto _err1
  39. if not exist a:\pkunpak.exe goto _err2
  40. if not exist a:\comment.txt goto _err3
  41. if not exist a:\zip\nul goto _err8
  42.  
  43. rem Check that no wildcards or extension was used
  44. for %%f in (%1) do if "%%f"=="%1" goto _ok
  45. echo.
  46. echo Wildcards / extensions not allowed in %1
  47. goto _out
  48.  
  49. :_ok
  50. rem Build the names for source .arc and target .zip files
  51. set _filea=b:\%1.arc
  52. set _filez=a:\zip\%1.zip
  53. if not exist %_filea% goto _err4
  54. if exist %_filez% goto _err5
  55. if not exist a:\tmp$$$\nul md a:\tmp$$$
  56. if exist a:\tmp$$$\*.* goto _err9
  57.  
  58. rem Test archive integrity
  59. a:\pkunpak -t %_filea%
  60. if errorlevel==1 goto _err10
  61.  
  62. rem Convert, use the date of the latest file, not the current date
  63. a:\pkunpak %_filea% a:\tmp$$$
  64. a:\pkzip -a %_filez% a:\comment.txt
  65. a:\pkzip -z %_filez% < a:\comment.txt
  66. a:\pkzip -d %_filez% comment.txt
  67. a:\pkzip -br:\ -u -m -o %_filez% a:\tmp$$$\*.*
  68. a:\pkzip -v %_filez%
  69. rd a:\tmp$$$
  70.  
  71. rem State of the /r switch for replacing the old .arc file
  72. if "%2"=="/r" goto _replace
  73. if "%2"=="/R" goto _replace
  74. goto _out
  75.  
  76. rem Replace the old .arc file with the new .zip file
  77. :_replace
  78. echo To replace %_filea% with %_filez% press any key
  79. echo To cancel, use the Break key now
  80. pause >nul
  81. if not exist %_filez% goto _err6
  82. if exist %_filea% del %_filea%
  83. if exist %_filea% goto _err7
  84. copy %_filez% b:\
  85. del %_filez%
  86. dir b:\%1.zip
  87. goto _out
  88.  
  89. :_err1
  90. Echo File a:\pkzip.exe not found
  91. goto _out
  92.  
  93. :_err2
  94. Echo File a:\pkunpak.exe not found
  95. goto _out
  96.  
  97. :_err3
  98. Echo File a:\comment.txt not found
  99. goto _out
  100.  
  101. :_err4
  102. Echo File %_filea% not found
  103. echo.
  104. echo Usage: ARC2ZIP PackageName [/r(eplace the old .arc with the new .zip)]
  105. echo Use no drive name! No extension!
  106. echo        ┌───────────────┐
  107. echo        │ NO WILDCARDS! │
  108. echo        └───────────────┘
  109. goto _out
  110.  
  111. :_err5
  112. Echo File %_filez% already exists
  113. goto _out
  114.  
  115. :_err6
  116. Echo ARC2ZIP aborted: File %_filez% not found
  117. goto _out
  118.  
  119. :_err7
  120. Echo ARC2ZIP aborted: Disk or file %_filea% is readonly
  121. goto _out
  122.  
  123. :_err8
  124. Echo Error: Directory a:\zip does not exist
  125. goto _out
  126.  
  127. :_err9
  128. Echo Error: Directory a:\tmp$$$ is not empty
  129. goto _out
  130.  
  131. :_err10
  132. Echo ARC2ZIP aborted: Error in %_filea%
  133. goto _out
  134.  
  135. :_out
  136. set _filea=
  137. set _filez=
  138. echo on
  139.